import requests
from common.my_requests import Myrequests

datas = {"password": "12345678",
         "username": "18123456789"}
url_login = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/login"

resp = requests.post(url_login, json=datas)
req_dict_login = resp.json()
token = req_dict_login["data"]["token"]

# url_household_updata = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/householder/update/167755211200001"
# datas_household = {"id":167755211200001,"name":"大范围","sex":0,"nation":None,"type":"1","birthDate":"1988-06-04","birthPlace":None,"certificateType":1,"idNumber":"500241198806040056","mobile":"13874122032","checkInDate":1677552112,"outmigrationDate":None,"communityName":"小区1","houseIdentifier":"100001-1-4-1-1-B外302","houseIdentifierShort":"4-1-1-B外302","state":1,"stateName":None,"phone":None,"career":None,"employer":None,"address":None,"remark":None,"communityId":164307599500001,"gmtCreate":1677552112,"gmtModified":1677552112,"householdRegistrationAddress":None,"userId":164307508600001,"userName":None,"houseName":"楼栋4-单元1-B外302","houseCode":["100001-1-4-","100001-1-4-1-","100001-1-4-1-1-B外302"],"houseNum":["100001-1-4-","100001-1-4-1-","100001-1-4-1-1-B外302"]}
req_heard = {"token": token}
# resp_household_updata = requests.post(url_household_updata, json=datas_household, headers=req_heard)
# req_dict_household_updata = resp_household_updata.json()
# print(req_dict_household_updata)

url_household = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/householder/query?pageSize=10&pageNum=1&query=community_id:eq:164307599500001%3Bor%3Bname:like:%25%25%3Bmobile:like:%25%25"
req_household = requests.get(url_household, headers=req_heard)
req_dict_household = req_household.json()
print(req_dict_household)
household_id = req_dict_household["data"]["list"]
# print(household_id)

householdid = []
for i in household_id:
    householdid.append(i.get("id"))

# for i in householdid:
#     print("https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/householder/update/{}".format(i))




url_household_updata = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/householder/update/{}".format(i)
datas_household = {"id":167755211200001,"name":"大范围","sex":0,"nation":None,"type":"1","birthDate":"1988-06-04","birthPlace":None,"certificateType":1,"idNumber":"500241198806040056","mobile":"13874122032","checkInDate":1677552112,"outmigrationDate":None,"communityName":"小区1","houseIdentifier":"100001-1-4-1-1-B外302","houseIdentifierShort":"4-1-1-B外302","state":1,"stateName":None,"phone":None,"career":None,"employer":None,"address":None,"remark":None,"communityId":164307599500001,"gmtCreate":1677552112,"gmtModified":1677552112,"householdRegistrationAddress":None,"userId":164307508600001,"userName":None,"houseName":"楼栋4-单元1-B外302","houseCode":["100001-1-4-","100001-1-4-1-","100001-1-4-1-1-B外302"],"houseNum":["100001-1-4-","100001-1-4-1-","100001-1-4-1-1-B外302"]}
req_heard = {"token": token}
resp_household_updata = requests.post(url_household_updata, json=datas_household, headers=req_heard)
req_dict_household_updata = resp_household_updata.json()
print(req_dict_household_updata)

